package com.milvus.controller;

import com.milvus.service.SearcherService;
import io.milvus.v2.service.vector.response.SearchResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;


@RestController
public class MilvusController {

    @Autowired
    SearcherService searcherService;

    /**
     * 以图搜图
     * @return
     * @throws IOException
     */
    @GetMapping("/searchImage")
    public List<List<SearchResp.SearchResult>>  searchImage(MultipartFile file) throws IOException {
        return searcherService.search( file);
    }

    //todo 支持上传视频文件，大文件上传
    //todo 文件去重
    //todo 文件信息要能够保存到数据库和Milvus中 记录图片在视频的秒信息

}
